#include <main.h>


#use i2c(Master,Fast,sda=PIN_B9,scl=PIN_B8,force_hw)

void main()
{

   setup_adc_ports(sAN0 | sAN1 | sAN2 | sAN3 | sAN4 | sAN5);
   setup_adc(ADC_CLOCK_DIV_2 | ADC_TAD_MUL_2);



   setup_timer1(TMR_DISABLED|TMR_DIV_BY_1);


   setup_motor_pwm(1,MPWM_FREE_RUN ,1,1,2048);  
   set_motor_unit( 1,1,MPWM_INDEPENDENT | MPWM_ENABLE_H,0,0); 
   set_motor_unit( 1,2,MPWM_INDEPENDENT | MPWM_ENABLE_H,0,0);
   set_motor_unit( 1,3,MPWM_INDEPENDENT | MPWM_ENABLE_L,0,0);
   
   
   
   
   set_motor_pwm_duty(1,1,1024);  //Probando
   set_motor_pwm_duty(1,2,4000);  //D=50%
   set_motor_pwm_duty(1,3,0);  //D=50%







while(1)
{
cambio(led);
delay_ms(250);
}

   // TODO: USER CODE!!

}
